package cn.wwk.notification.unit.controller;

import cn.wwk.notification.common.domain.Location;
import cn.wwk.notification.common.result.Result;
import cn.wwk.notification.unit.service.LocationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author wwk
 */
@RestController
@Slf4j
@RequestMapping("/location")
public class LocationController {

    @Resource
    private LocationService locationService;

    @GetMapping("/list")
    public Result getAll(){
        List<Location> list = locationService.list();
        return Result.success(list);
    }

    @GetMapping("/get/{id}")
    public Result getById(@PathVariable("id") String id){
        Location location = locationService.getById(id);
        return Result.success(location);
    }
}
